using System;
using UnityEngine;
using UnityEngine.UI;

namespace CGF
{
    //该脚本自动生成或覆盖，不可编辑
    public partial class TabDevices
    {   
		public Text TextCount;
		public CButton BtnBatchRenew;
		public CButton BtnMore;
		public ScrollView ScrollView;
		public CButton BtnLease;
		public Text Empty;
		public Text Hot;
		public ScrollView ScrollViewShop;
		public I18N i18n;

        public Reference reference { get; private set; }
        public Action onProsBindCompleted;
        public bool isProsBindCompleted;
        
        public void BindProperties(Transform transform)
        {   
            reference = transform.GetComponent<Reference>();
            if(!reference)return;
            int nodeIndex = 0;
			TextCount = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<Text>();
			BtnBatchRenew = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<CButton>();
			BtnMore = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<CButton>();
			ScrollView = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<ScrollView>();
			BtnLease = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<CButton>();
			Empty = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<Text>();
			Hot = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<Text>();
			ScrollViewShop = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<ScrollView>();
			i18n = transform.GetComponent<I18N>();
            isProsBindCompleted = true;
            onProsBindCompleted?.Invoke();
        }
        
        public void SetProsBindCompletedAction(Action action)
        {
            if (isProsBindCompleted)
            {
                action?.Invoke();
            }
            else
            {
                onProsBindCompleted = action;
            }
        }

		public string I18N_total { get { return i18n.GetTextByKey("total"); } }
		public string I18N_device { get { return i18n.GetTextByKey("device"); } }
		public string I18N_code { get { return i18n.GetTextByKey("code"); } }
		public string I18N_working { get { return i18n.GetTextByKey("working"); } }
		public string I18N_total_income { get { return i18n.GetTextByKey("total_income"); } }
		public string I18N_remain_day { get { return i18n.GetTextByKey("remain_day"); } }
		public string I18N_renew_success { get { return i18n.GetTextByKey("renew_success"); } }
		public string I18N_balance_not_enough { get { return i18n.GetTextByKey("balance_not_enough"); } }
		public string I18N_goto_rechage { get { return i18n.GetTextByKey("goto_rechage"); } }
		public string I18N_renew { get { return i18n.GetTextByKey("renew"); } }
		public string I18N_lease_atonce { get { return i18n.GetTextByKey("lease_atonce"); } }
    }
}
